home *** CD-ROM | disk | FTP | other *** search
- #include <arpbase.h>
- #include <arp_proto.h>
- #include "Launch.h"
- #include "LaunchPriv.h"
-
-
- /*
- * NAME
- * WaitProcess -- wait for a particular process to end.
- *
- * SYNOPSIS
- * WaitProcess (Proc)
- *
- * void WaitProcess (struct Process *);
- *
- * DESCRIPTION
- * Check if the process pair list exists, check if the child
- * process exists and if it's alive. Wait until it dies and
- * remove the process pair from the list, free the parent signal
- * and free the memory.
- *
- * Free the list if it's empty.
- *
- * INPUT
- * Proc - the child process to be waiting upon.
- *
- * OUTPUT
- * None.
- *
- * NOTE
- * You MUST be the parent of the process !!!
- *
- * HISTORY
- * 1992/09/06 Pierre Baillargeon Creation
- *
- * SEE ALSO
- * WaitProcesses(), WaitProcFunc()
- */
-
- void WaitProcess (struct Process *Proc)
- {
- struct ProcPair *pp;
-
- Forbid ();
- if (ProcPairList)
- {
- if (pp = IsChild (Proc))
- {
- while (pp->pp_ChildEntry)
- {
- Wait (1L << pp->pp_ParentBit | KILL_PROCESS_FLAG);
- }
- Remove (pp);
- FreeParentSignal (pp->pp_ParentBit);
- FreeMem (pp, sizeof (struct ProcPair));
- }
- FreeProcPairList ();
- }
- Permit ();
- }
-